package com.qifan.energy.bean.result;

import android.text.TextUtils;

public class OSSPolicyResult {

    /**
     * accessKeyId : 访问身份验证中用到用户标识
     * callback : 上传成功后的回调设置
     * dir : 上传文件夹路径前缀
     * host : oss对外服务的访问域名
     * policy : 用户表单上传的策略,经过base64编码过的字符串
     * signature : 对policy签名后的字符串
     */

    private String accessKeyId;
    private String callback;
    private String dir;
    private String host;
    private String policy;
    private String signature;

    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getCallback() {
        return callback;
    }

    public void setCallback(String callback) {
        this.callback = callback;
    }

    public String getDir() {
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPolicy() {
        return policy;
    }

    public void setPolicy(String policy) {
        this.policy = policy;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    //oss-cn-beijing.aliyuncs.com
    public String getDomain() {
        if (!TextUtils.isEmpty(getHost())) {
            String[] splits = getHost().split("typhoon-mall.");
            if (splits.length>1){
                return splits[1];
            }
        }
        return "";
    }

    //获取BucketName
    public String getBucketName(){
        return "typhoon-mall";
    }
}
